<%@ LANGUAGE="VBSCRIPT" %>
<%'  ------------------------------------------------------------
  '  properties.asp 
  '  ------------------------------------------------------------
  '  VCS INFO:
  '  
  '  $Revision:   1.16  $
  '  $Date:   24 May 1998 17:36:38  $
  '  $Author:   bposert  $
  '  $Workfile:   properties.asp  $
  '  ------------------------------------------------------------
  '  All Rights Reserved.  Copyright (c) 1988-1998 FileNET Corp.
  '  ------------------------------------------------------------
  '%>

<%
' Retrieve query string info, i.e. parameters specified in the URL.
LibraryName = Request.QueryString("LibraryName")
SystemType = Request.QueryString("SystemType")
LogonID = Request.QueryString("LogonID")
DocID = Request.QueryString("DocID")
Page = Request.QueryString("Page")

' Default page number to 1, if it's not specified.
if Page = "" then
	Page = 1
else
	Page = CLng(Page)
end if

' See if there is any form-data specified and what type of data it is.
RequestType = Request.Form("FormDataType")

On Error Resume Next

' Create the PropertyGateway object.
set PropGWObj = Server.CreateObject("IDMObjects.PropertyGateway")

if RequestType = "" then
    ' There is no form-data specified in the request.  Assume retrieval request
    ' and tell PropertyGateway object to retrieve annotations.
    err = PropGWObj.RetrieveAnnoList(DocID, Page, LibraryName, SystemType, LogonID, AnnoList)
    if err <> 0 then
	    Response.Expires = 0
	    Response.Status = "404 Not Found"
	    Response.ContentType = "text/plain"
	    Response.Write Err.Description
	    Response.End
    else
	    ' Send retrieved annotation list back to client.
        Response.ContentType = "application/octet-stream"
	    Response.BinaryWrite AnnoList
    end if
elseif (RequestType = "ModifiedAnnos") then
    ' There is form-data specified in the request and it identifies dirty
    ' and/or deleted annotations.  Get the modified annotation list.
    ModifiedAnnoList = Request.Form("AnnoData")

    ' Have the PropertyGateway object update the annotations.
    ' Annotations marked as dirty in ModifiedAnnoList will be saved.
    ' Annotations marked as deleted will be deleted.
    err = PropGWObj.SaveAnnotations(DocID, LibraryName, SystemType, LogonID, ModifiedAnnoList)

    ' Send success/failure code back to client.
    Response.ContentType = "application/octet-stream"
    Response.BinaryWrite CStr(err)
end if
%>
